package com.crm.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {

   /* @Autowired
    private DiscoveryClient discoveryClient;*/

   @Value("${server.port}")
   private String port;


    @RequestMapping(value = "/info",method = RequestMethod.GET)
    public Object getInfo(){
        Map<String,String> maps = new HashMap<>();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        maps.put("name","ceshi");
        maps.put("age","12");
        maps.put("port",port);
        return maps;
    }

    @RequestMapping(value = "/getInfo",method = RequestMethod.GET)
    public Object getInfo(@RequestParam(value = "id")Long id){
        Map<String,Object> response = new HashMap<>();
        response.put("id",id);
        response.put("name","test"+id);
        return response;
    }
}
